find triplets for an array whose sum is equal to target